<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function addText(){
				let text = document.createElement("div")
				text.innerHTML="文字节点"
				document.querySelector(".con").appendChild(text)
			}
			function addPic(){
				let pic = document.createElement("img")
				pic.setAttribute("src"," ../web2025/src/ok.png")
				document.querySelector(".con").appendChild(pic)
			}
			function deltext(){
				let text = document.querySelector(".con>div")
				text.parentNode.removeChild(text)
			}
			function delpic(){
				let text = document.querySelector(".con>img")
				text.parentNode.removeChild(text)
			}
			function delfir(){
				let text = document.querySelector(".con")
				text.removeChild(text.firstChild)
			}
			function dellas(){
				let text = document.querySelector(".con")
				text.removeChild(text.lastChild)
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="addText()">添加文本</button>
		<button type="button" onclick="addPic()">添加图片</button>
		<button type="button" onclick="deltext()">删除第一个文本</button>
		<button type="button" onclick="delpic()">删除第一个图片</button>
		<button type="button" onclick="delfir()">删除第一个孩子</button>
		<button type="button" onclick="dellas()">删除最后一个孩子</button>
		<div id="" class="con"></div>
	</body>
</html>
